<div class="link_projects">

	<div class="lbl">

		<%# start the form tag for (quick) search results -%>
		<% form_remote_tag(:html => {:id => 'searchform'},
							:update => 'results',
							:complete => 'showResults(true);',
							:loading => 'showResults(false);',
							:url => "#{Site.full_url}/search") do -%>

			<div id="searchfields">
				<input type="text" name="q" id="q" value="Search blog" onfocus="searchFocus()" />
				<input type="submit" id="searchsubmit" value="Search" />
			</div>

		<% end -%>
		<%# end (quick) search form tag -%>
	</div>
	
	<span class="left">
		<a href="<%= Site.comments_rss_url %>" class="g1"><span>RSS</span><br />Comment Feed</a>
	</span>
	<span class="right">
		<a href="<%= Site.rss_url %>" class="g2"><span>RSS</span><br />Full-text Feed</a>
	</span>

</div>

<div id="searchresults">
	<div class="link_updates">

		<div class="lbl" id="loading">Searching... <%= theme_image_tag 'loading.gif', :alt => 'Searching...' %></div>
		<span id="results"></span>
	
		<div class="clearer"><span></span></div>

	</div>
</div>

<div class="link_updates">

	<div class="lbl">Categories</div>

	<%
		tags = Tag.find(:all).inject([]) do |a,t|
			p = Site.get_posts("select p.* from posts as p, tags_posts as tp where p.is_active = true and p.id = tp.post_id and tp.tag_id = #{t.id} order by p.created_at desc limit 1").first
			a << { :name => t.name, :title => p.title, :date => p.created_at } if p
			a
		end.sort! { |x,y| -( x[:date] <=> y[:date]) }
	-%>
	<% tags.each do |t| -%>
		<a href="<%= Site.full_url %>/<%= Site.archive_token %>/tags/<%= t[:name] %>" title="<%= t[:name] %>"><p><b><%= t[:name] %></b><br/><%= t[:title] %><br/><%= t[:date].strftime(Site.date_format) %> <%= t[:date].strftime(Site.time_format) %></p></a>
	<% end -%>
		
	<div class="clearer"><span></span></div>

</div>

